<?php ob_start();
include("header.php" );
validate_user();
if(isset($_SESSION['url_id'])){ $url=get_allitem('my_business_url','id',$_SESSION['url_id']); }
$obj= new mycity();
//Submit Gallery Name///////////////////////////////////////////////////////////
if(isset($_POST['gallery_title'])&&($_POST['gallery_title']!='')){ 
	$sql=mysql_query("INSERT INTO `my_gallery` SET `name`='".$_POST['gallery_title']."',
												`user_id`='".$_SESSION['id']."',
												`url_id`='".$_SESSION['url_id']."',
												`status` = 0 ")or die(mysql_error());
	if($sql){
		header("location:create_page_step3.php"); exit;
	}
}
?>

<!--Body Section start-->
<div class="body_div" style="margin: 0 auto; float:none;">
<div class="create_page_head">

<div id="url">
    <h1><span>http://www.mycitydial.com/<?php if(isset($url['url'])){ echo cut_text($url['url'],75);} ?></span>
     <input type="text" class="long_box" value="<?php if(isset($url['url'])){ echo cut_text($url['url'],75);} ?>" style="width:400px" />
    </h1>
    <input type="hidden" id="urlid" value="<?php if(isset($url['id'])){ echo $url['id'];} ?>" />
    <a href="javascript:;" id="urledit">+Edit</a><span id='msg' style='color:red;'></span>
</div> 
 </div>

<!--Create page Steps div start-->
<div class="steps_div">
<div class="steps">
<ul>
<li><a href="#" class="current">
<div>
<img src="images/steps/1_black.png" />
<img src="images/steps/1.png" />
<span>Home Page</span>
</div>
</a></li>

<li><a href="#" class="active">
<div>
<img src="images/steps/02.png" />
<img src="images/steps/2.png" />
<span>Page Gallery</span>
</div>
</a></li>

<li><a href="#">
<div>
<img src="images/steps/03.png" />
<img src="images/steps/3.png" />
<span>About Page </span>
</div>
</a></li>

<li><a href="#">
<div>
<img src="images/steps/4_black.png" />
<img src="images/steps/4.png" />
<span>Owner Profile </span>
</div>
</a></li>
</ul>
</div> 
<ul id="output2">
 

<!--.......................-->
<li>
<div class="header_navi"> 
  <h2>Create your Page Gallery</h2>
  <div class="btn"> 
    <div class="nextprev">
     <a href="create_page_step1.php"><img src="images/prev.png"  /></a>
<a href="create_page_step3.php"><img src="images/next.png"  /></a>     
    </div>
    
    <div class="nextstep"><a href="create_page_step3.php" id="btnstep2" class="inputbtn">Save and Next</a></div>
    
  </div>
  
</div>

<div class="setps_form_heading">
<div class="tab_name">
<span>Gallery Tab Name</span>
<form  style="height:0px; width:0px; overflow:hidden;"id="imageform" method="post" enctype="multipart/form-data" action='ajaximage.php'>
  <input type="file" name="item_file[]" id="photoimg" multiple='multiple' />
</form>

<form id="step2"  method="post" enctype="multipart/form-data" action="">
<input name="gallery_title" id="gallery_title" type="text" class="tab_box" value="<?php $url=get_item('my_gallery','url_id',$_SESSION['url_id'],'name'); if(!empty($url)){ echo $url; }else{echo "Enter Your gallery name";} ?>"   />
</form>
</div>
 
<div class="uploaderimg">
 <h3><?php echo $obj->count_rowall("SELECT * FROM `my_images` WHERE `url_id`='".$_SESSION['url_id']."'"); ?> Photos</h3>
<!-- <a href="#" class="inputbtn" >Save and Publish</a> -->
 
 <a href="#" class="inputbtn" onclick="$('#photoimg').click()" >Upload Photo <div class="loadgif"><img src="images/loader.gif" alt="Uploading...."/></div></a>
 


</div>


</div>

<!--Photo Gallery start-->
<div class="photo_gallery">
<?php $sql=mysql_query("SELECT * FROM `my_images` WHERE `url_id` ='".$_SESSION['url_id']."'")or die(mysql_error());
while($row=mysql_fetch_array($sql)){
?>
<section class='photo_section'>
<div class='photo_main'><img src='uploads/thumb/t_<?php echo $row['image']; ?>' height='172' width='138'  ></div>
<div class='photo_select'><img src="images/delete_bt.png" onclick="deleteimg(this,'<?php echo $row['id']; ?>');" style="float: left;margin-right: 4px;" />
<span> <p class="alt_txt"><?php echo $row['alt_text']; ?></p> 
<input type='text' value='<?php echo $row['alt_text']; ?>' name='alt_text'  title="<?php echo $row['id']; ?>"  style='width: 109px;margin-top: -5px;display:none;'/></span> 
</div>
</section>
<?php }?>
</div>
<!--Photo  Gallery end-->
</li>
<!--.......................-->

 
<!--.......................-->

 

</ul>
</div>
<!--Create page Steps div end-->
<br clear="all" />
<br clear="all" />
</div>





</div>

<? include("footer.php");  ?>

